export default {
  state: {
    breads: [{ name: '首页' }]
  },
  getters: {
    aBreads: state => state.breads
  },
  actions: {
    resetBreads(state, payload) {
      setTimeout(() => {
        state.commit('resetBreads', payload)
      }, 1)
    },
    addBreads(state, payload) {
      state.breads.push(payload)
    },
    setBreads(state, payload) {
      setTimeout(() => {
        state.commit('setAllBreads', payload)
      }, 1)
    }
  },
  mutations: {
    resetBreads(state, payload) {
      state.breads = [{ name: '首页' }]
    },
    addBreads(state, payload) {
      state.breads.push(payload)
    },
    setAllBreads(state, payload) {
      state.breads = payload
    }
  }
}
